define("Neptuno.Puertos.PuertosExplorer", ["jquery.mobile", "jquery.mobile.simpledialog2"],
    function ($) {
        var self = {
            el:"",
            config:{
                parent:"",
                onPuertoTap:function(){
                    
                },
                onClose:function(){
                    console.log("XXX");
                }
            },
            close:function(){
                $.mobile.pageContainer.off("tap", ".puertos-explorer-puerto");
                $.mobile.pageContainer.off("tap", ".explorer-close");
                
                $.mobile.changePage($(self.config.parent), {
                    transition: "pop",
                    reverse: true,
                });
            }
        }
        return {
            explore:function(options){
                self.config = $.extend(self.config, options);
                
                $.mobile.pageContainer.on("tap", ".puertos-explorer-puerto", self.config.onPuertoTap);
                $.mobile.pageContainer.on("tap", ".explorer-close", self.close);
                
                $(self.config.parent).one("pageshow", self.config.onClose);
                
                $.mobile.changePage("index.php?controller=Neptuno.ExplorarPuertos");
            },
            close:function(){
                self.close();
            }
        }
    });